package Server;

import Shared.Doctor;
import Shared.Government;
import Shared.Nurse;
import Shared.Patient;
import Shared.User;

public class UserFactory {
	public static User generate(String user) {
		String[] split = user.split("\\|");
		
		if (split[4].toUpperCase().equals("DOCTOR")) {
			return new Doctor(user);
		} else if (split[4].toUpperCase().equals("NURSE")) {
			return new Nurse(user);
		} else if (split[4].toUpperCase().equals("GOVERNMENT")) {
			return new Government(user);
		} else if (split[4].toUpperCase().equals("PATIENT")) {
			return new Patient(user);
		}

		return null;
	}
}
